//
//  line object
//

object line
  attrs
    point   start
    point   stop
  end

  procs
    def init
      ins
        point   start
        point   stop
      end

      .start.init( start.x, start.y, start.z )
      .stop.init( stop.x, stop.y, stop.z )
    end

    def deinit
      .start.deinit()
      .stop.deinit()
    end

    def stretch
      ins
        float   dist
      end
      
      float     v_x
      float     v_y
      float     v_z

      float     v_l

      v_x       :=  ( .stop.x - .start.x )
      v_y       :=  ( .stop.y - .start.y )
      v_z       :=  ( .stop.z - .start.z )
      
      v_l       :=  ( ( v_x * v_x ) + ( v_y * v_y ) + ( v_z * v_z ) )
      v_l.sqrt()

      dist      :=  ( dist / v_l )

      v_x       :=  ( v_x * dist )
      v_y       :=  ( v_y * dist )
      v_z       :=  ( v_z * dist )

      .stop.x   :=  ( .start.x + v_x )
      .stop.y   :=  ( .start.y + v_y )
      .stop.z   :=  ( .start.z + v_z )
    end
  end
end

